﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BuXiaChu.OrderDishes.Model;
using BuXiaChu.OrderDishes.BLL;

namespace BuXiaChu.OrderDishes.Web.Admin.Sys
{
    public partial class Roles : System.Web.UI.Page
    {
        protected List<RolesModel> rolesList = null;
        protected List<ApplicationsModel> appList = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            InitData();
        }

        private void InitData()
        {
            rolesList = RolesManager.GetAll();
            appList = CodeDictionary.Instance.GetApplications();
            foreach (var item in appList)
            {
                sel_Applications.Items.Add(new ListItem(item.Name,item.ApplicationId.ToString()));
            }
        }

        protected string GetAppName(Guid id)
        {
            var name = "";
            foreach (var item in appList)
            {
                if (item.ApplicationId == id)
                {
                    name = item.Name;
                    break;
                }
            }
            return name;
        }
    }
}
